/*
 * FeaturePoint.cpp
 *
 *  Created on: Apr 14, 2009
 *      Author: wrice
 */

#include "MyVideoTrace.h"
namespace MyVideoTrace {

FeaturePoint::FeaturePoint(int id)
: fpointId_(id)
{
}

FeaturePoint::Points2DIterator FeaturePoint::beginPoint2D() {
	return points2d_.begin();
}

FeaturePoint::Points2DIterator FeaturePoint::endPoint2D() {
	return points2d_.end();
}

size_t FeaturePoint::sizePoint2D() const {
	return points2d_.size();
}

FeaturePoint::Points2DIterator FeaturePoint::findPoint2D(FrameNumber whichFrame) {
	return points2d_.find(whichFrame);
}

void FeaturePoint::setPoint2D(FrameNumber whichFrame, Point2D point2d) {
	points2d_.insert( pair< FrameNumber, Point2D >( whichFrame, point2d ) );
}

void FeaturePoint::removePoint2D(FrameNumber whichFrame) {
	points2d_.erase(whichFrame);
}

ostream &operator<<(ostream &stream, FeaturePoint rhs) {
	stream << "FeaturePoint [ size = " << rhs.sizePoint2D() << ", map [";
	FeaturePoint::Points2DIterator iter = rhs.beginPoint2D();
	const FeaturePoint::Points2DIterator iterEnd = rhs.endPoint2D();
	for(; iter != iterEnd; ++iter) {
		stream << " ( " << iter->first << ", " << iter->second << " )";
	}
	stream << " ] ]";
	return stream;
}

int FeaturePoint::getFeaturePointID() const {
	return fpointId_;
}

void FeaturePoint::setPoint3D( float x, float y, float z ) {
	x_ = x;
	y_ = y;
	z_ = z;
}

Vector3f FeaturePoint::getPoint3D() const {
	return Vector3f( getX(), getY(), getZ() );
}

void FeaturePoint::setPoint3D( Vector3f aValue ) {
	x_ = aValue.getX();
	y_ = aValue.getY();
	z_ = aValue.getZ();
}

float FeaturePoint::getX() const {
	return x_;
}

float FeaturePoint::getY() const {
	return y_;
}

float FeaturePoint::getZ() const {
	return z_;
}

}
